<template>
  <div class="viewCustomerDetails">
    <div class="header-top">
      <div class="head-title" @click="gotoPage">
        <i class="el-icon-back"></i>客户详情
      </div>
    </div>
    <div class="content-main">
      <div class="userInfo">
        <div class="user-img"><img src="../../../assets/images/profile.jpg"/></div>
        <div class="user-name">闵雨薇</div>
        <div class="user-unit">@锐行</div>
        <div class="label-list">
          <label>企业标签：</label>
          <span>一般</span>
          <span>重要</span>
          <span>核心</span>
        </div>
        <div class="label-list">
          <label>企业标签：</label>
          <span>未入VIP群</span>
          <span>持续7天未发言</span>
          <span><1000</span>
        </div>
        <el-button type="primary" class="chart">聊天</el-button>
      </div>
      <div class="content-big">
        <ul class="tablist">
          <li :class="active==0?`active`:``" @click="getActive(0)">详细信息</li>
          <li :class="active==1?`active`:``" @click="getActive(1)">所在群聊</li>
        </ul>
        <detailedInfo v-if="active==0"></detailedInfo>
        <groupChart v-if="active==1"></groupChart>
      </div>
    </div>


  </div>
</template>

<script>
export default {
  name: 'viewCustomerDetails',
  components: {
    'detailedInfo': () => import('./detailedInfo.vue'),//导出弹窗
    'groupChart': () => import('./groupChart.vue'),//导出弹窗
  },
  data() {
    return {
      active: 0,
      form: {
        labelList: [
          {
            name: null,
          }
        ],
      },
      rules: {
        'name': [
          {required: true, message: '请输入标签名称', trigger: 'blur'}
        ],

      },
    }
  },
  created() {
  },
  mounted() {
  },
  watch: {},
  methods: {
    getActive(index) {
      this.active = index;
    },
    onSubmit(formName) {
      //提交的代码
      this.$refs[formName].validate((valid) => {
        if (valid) {
          console.log('提交表单');
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    gotoPage() {
      this.$router.push({
        name: 'customerMgtList',
        query:{
          urlActive:0,
        }
      })
    },
    handleCloseDialog() {
      this.$emit('update:visableIf', false);
      this.$emit('handleQuery');
    }
  }
}
</script>

<style scoped lang="scss">
.header-top {
  height: 46px;
  background: #fff;
  border-bottom: 1px solid #e9e9e9;
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 20px;

  .head-title {
    font-size: 14px;
    line-height: 22px;
    margin-right: 10px;
    display: flex;
    align-items: center;

    i {
      font-size: 20px;
      font-weight: bold;
      cursor: pointer;
      margin-right: 10px;
    }
  }

}

.content-main {
  height: calc(100vh - 120px);
  overflow-y: auto;
}

.userInfo {
  position: relative;
  background: #fff;
  padding: 16px;
  margin: 12px;
  padding-left: 100px;

  .user-img {
    width: 60px;
    height: 60px;
    position: absolute;
    left: 16px;
    top: 16px;

    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      border-radius: 4px;

    }
  }

  .user-name {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 0;
    line-height: 24px;
  }

  .user-unit {
    display: inline-block;
    font-size: 12px;
    color: #f90;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .label-list {
    label {
      font-size: 14px;
      line-height: 1.5715;
      word-wrap: break-word;
      font-weight: 400;
    }

    span {
      margin: 4px 4px 4px 0;
      font-size: 12px;
      height: 25px;
      line-height: 25px;
      white-space: nowrap;
      background: #f0f0f0;
      border: 1px solid #e9e9e9;
      border-radius: 4px;
      padding: 0px 7px;
      display: inline-block;

    }
  }
}

.chart {
  position: absolute;
  right: 20px;
  top: 20px;
}

.tablist {
  display: flex;
  height: 46px;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #eee;

  li {
    list-style: none;
    margin: 0 0 0 32px;
    cursor: pointer;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;

    &.active {
      color: #3070ff;
      text-shadow: 0 0 .25px currentColor;

      &:after {
        content: '';
        position: absolute;
        bottom: 0px;
        width: 100%;
        height: 1px;
        background: #3070ff;

      }
    }
  }

}

.content-big {
  background: #fff;
  margin: 12px;
  min-height: 600px;
}
</style>
